#include<iostream>
#include<vector>
using namespace std;

const int N = 2e6 + 10;
int n, m;
vector<int> a(N);

int main()
{
    //人数n, 询问次数m
    cin >> n >> m;
    for(int i = 1; i <= n; i ++)
        cin >> a[i];
    
    while(m --)
    {
        int x;
        cin >> x;
        cout << a[x] << endl;
    }

    return 0;
}